package com.maximgalushka.nio.nioclient;

/**
 * <p></p>
 *
 * @author Maxim Galushka
 * @since 22.06.12
 */

public class RspHandler {

    private byte[] rsp = null;

    public synchronized boolean handleResponse(byte[] rsp) {
        this.rsp = rsp;
        this.notify();
        return true;
    }

    public synchronized void waitForResponse() {
        while(this.rsp == null) {
            try {
                this.wait();
            } catch (InterruptedException e) {
            }
        }

        System.out.println(new String(this.rsp));
    }
}